Skip to content

<fix>[vm_local_volume_cache]: Set CacheTO in extension point#3578

Closed
zstack-robot-1 wants to merge 1 commit intofeature-5.5.6-local-cachefrom
sync/haidong.pang/ZSTAC-83649@@2
Closed

<fix>[vm_local_volume_cache]: Set CacheTO in extension point#3578
zstack-robot-1 wants to merge 1 commit intofeature-5.5.6-local-cachefrom
sync/haidong.pang/ZSTAC-83649@@2

Conversation

@zstack-robot-1
Copy link
Copy Markdown
Collaborator

Enable cache for an in-use volume omits some command fields
sent to the agent.

VmLocalVolumeCacheManagerImpl implements the convertVolumeIfNeed
method of KVMConvertVolumeExtensionPoint. CacheTO should be set
in the implementation of this extension point.

Resolves: ZSTAC-83649

Change-Id: I69757864676978787767736a6f777a7562636b75

sync from gitlab !9437

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 24, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: http://open.zstack.ai:20001/code-reviews/zstack-cloud.yaml (via .coderabbit.yaml)

Review profile: CHILL

Plan: Pro

Run ID: ac17159b-094d-4602-984f-dd075be11b96

📥 Commits

Reviewing files that changed from the base of the PR and between cc755f5 and 4ea7803.

📒 Files selected for processing (1)
  • plugin/kvm/src/main/java/org/zstack/kvm/VolumeTO.java

Walkthrough

新增了 valueOf(VolumeInventory vol, HostInventory host, String platform) 重载;在 VolumeTO.valueOf(...) 中移除了对本地卷缓存(VmLocalVolumeCacheVO)的查询与填充逻辑;方法在(可选)应用 KVMConvertVolumeExtensionPoint 后直接返回,返回对象不再设置 cache 字段。

Changes

Cohort / File(s) Summary
VolumeTO 修改
plugin/kvm/src/main/java/org/zstack/kvm/VolumeTO.java
新增重载 valueOf(VolumeInventory, HostInventory, String);删除通过 VmLocalVolumeCacheVO 查询并构建 VmLocalVolumeCacheInventory/CacheTO 的代码;在(可选)应用 KVMConvertVolumeExtensionPoint 后直接返回 VolumeTO,不再调用 to.setCache(...)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

我是草丛里的一只小兔子,🐇
跳过了缓存那条旧径,
VolumeTO 轻快地奔去,
扩展点边微风轻拂,
新重载,少了几行纷扰。

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed PR标题遵循了[scope]: 格式,且长度为60字符,符合72字符以内的要求。
Description check ✅ Passed PR描述详细阐述了缓存逻辑迁移的目的和背景,与代码变更高度相关。
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch sync/haidong.pang/ZSTAC-83649@@2

Comment @coderabbitai help to get the list of available commands and usage tips.

@zstack-robot-2
Copy link
Copy Markdown
Collaborator

Comment from yaohua.wu:

Review: MR !9437 — ZSTAC-83649

将 cache 注入逻辑从 core VolumeTO.valueOf() 迁移到 premium 扩展点

变更概要:删除 VolumeTO.valueOf() 中直接引用 VmLocalVolumeCacheVO 的 cache 设置代码,该逻辑已迁移到 premium 模块的 VmLocalVolumeCacheManagerImpl.convertVolumeIfNeed() 扩展点实现中(见 premium !13298)。

架构评价:正确。core 模块不应直接依赖 premium 类型。通过 KVMConvertVolumeExtensionPoint 扩展点解耦,符合 ZStack 插件化架构。

Warning

  1. [VolumeTO.java] 删除 cache 逻辑后遗留未使用的 import

    以下 import 在删除 cache 代码后不再被使用,应一并清理:

    import org.zstack.header.localVolumeCache.VmLocalVolumeCacheInventory;  // line 8
    import org.zstack.header.localVolumeCache.VmLocalVolumeCacheVO;         // line 9
    import org.zstack.header.localVolumeCache.VmLocalVolumeCacheVO_;        // line 10

Suggestion

  1. [VolumeTO.java:161] 多余空格return to; 有双空格,建议修为 return to;(此为原有问题,可顺手修复)

Verdict: APPROVED

详细 review 见 premium MR !13298 评论


🤖 Robot Reviewer

@MatheMatrix MatheMatrix force-pushed the sync/haidong.pang/ZSTAC-83649@@2 branch 2 times, most recently from bb20efa to cc755f5 Compare March 24, 2026 08:54
Enable cache for an in-use volume omits some command fields
sent to the agent.

VmLocalVolumeCacheManagerImpl implements the convertVolumeIfNeed
method of KVMConvertVolumeExtensionPoint. CacheTO should be set
in the implementation of this extension point.

Resolves: ZSTAC-83649

Change-Id: I69757864676978787767736a6f777a7562636b75
@MatheMatrix MatheMatrix force-pushed the sync/haidong.pang/ZSTAC-83649@@2 branch from cc755f5 to 4ea7803 Compare April 22, 2026 05:19
@zstack-robot-2 zstack-robot-2 deleted the sync/haidong.pang/ZSTAC-83649@@2 branch April 22, 2026 05:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants